﻿(function() {
    var d = function(a) {
        this.classReg = /^(\.).*/;
        this.idReg = /^(\#).*/;
        this.nameReg = /^(name=).*/;
        this.nodes = [];
        this.element = null;
        if ("string" == typeof a) if (a.match(this.classReg)) {
            this.element = document.getElementsByTagName("*");
            for (var b = 0; b < this.element.length; b++) a.replace(".", "") == this.element[b].className && this.nodes.push(this.element[b])
        } else if (a.match(this.idReg)) this.nodes.push(document.getElementById(a.replace("#", "")));
        else if (a.match(this.nameReg)) if (d.isIE()) {
            this.element = document.getElementsByTagName("*");
            for (b = 0; b < this.element.length; b++) this.element[b].getAttribute("name") == a.replace("name=", "") && this.nodes.push(this.element[b])
        } else {
            this.element = document.getElementsByName(a.replace("name=", ""));
            for (b = 0; b < this.element.length; b++) this.nodes.push(this.element[b])
        } else {
            this.element = document.getElementsByTagName(a);
            for (b = 0; b < this.element.length; b++) this.nodes.push(this.element[b])
        } else "object" == typeof a ? this.nodes.push(a) : "";
        return 1 == this.nodes.length ? new d.operation(this.nodes[0]) : new d.operation(this.nodes)
    };
    d.isIE = function() {
        return document.selection ? !0 : !1
    };
    d.browser = function(a) {
        if (void 0 == d.browser.info) {
            var b = {
                type: ""
            },
            c = navigator.userAgent.toLowerCase();
            /webkit/.test(c) ? b = {
                type: "webkit",
                version: /webkit[\/]([\w.]+)/
            }: /opera/.test(c) ? b = {
                type: "opera",
                version: /version/.test(c) ? /version[\/]([\w.]+)/: /opera[\/]([\w.]+)/
            }: /msie/.test(c) ? b = {
                type: "msie",
                version: /msie([\w.]+)/
            }: /mozilla/.test(c) && !/compatible/.test(c) && (b = {
                type: "ff",
                version: /rv:([\w.]+)/
            });
            b.version = (b.version && b.version.exec(c) || [0, "0"])[1];
            d.browser.info = b
        }
        return "type" == a || "version" == a ? d.browser.info[a] : d.browser.info
    };
    d.ready = function(a) {
        var b = [],
        c = /webkit\/(\d+)/i.test(navigator.userAgent) && 525 > RegExp.$1,
        e = function() {
            for (var a = 0; a < b.length; a++) b[a]()
        };
        if (!d.isIE() && !c && document.addEventListener) return document.addEventListener("DOMContentLoaded", a, !1);
        if (! (1 < b.push(a))) if (d.isIE())(function() {
            try {
                document.documentElement.doScroll("left"),
                e()
            } catch(a) {
                setTimeout(arguments.callee, 0)
            }
        })();
        else if (c) var g = setInterval(function() { / ^(loaded | complete) $ / .test(document.readyState) && (clearInterval(g), e())
        },
        0)
    };
    d.operation = function(a) {
        this.length = function() {
            if (void 0 == a || "" == a) return 0;
            if (void 0 == a.length) return 1;
            if (void 0 != a.length) return a.length
        };
        this.Element = function() {
            return void 0 == a ? void 0 : a[0] || a
        };
        this.first = function() {
            return void 0 == a.length || 2 > a.length ? void 0 : new d.operation(a[0])
        };
        this.last = function() {
            return void 0 == a.length || 2 > a.length ? void 0 : new d.operation(a[a.length - 1])
        };
        this.even = function() {
            if (! (2 > this.length())) {
                for (var b = [], c = 0; c < a.length; c++) 0 == c % 2 && b.push(a[c]);
                return new d.operation(b)
            }
        };
        this.odd = function() {
            if (! (2 > this.length())) {
                for (var b = [], c = 0; c < a.length; c++) 1 == c % 2 && b.push(a[c]);
                return new d.operation(b)
            }
        };
        this.eq = function(b) {
            return 1 > a.length ? void 0 : new d.operation(a[b])
        };
        this.gt = function(b) {
            if (! (0 > b || void 0 == a.length || a.length <= b)) {
                for (var c = [], b = b + 1; b < a.length; b++) c.push(a[b]);
                return new d.operation(c)
            }
        };
        this.lt = function(b) {
            if (! (0 > b || void 0 == a.length || b > a.length)) {
                for (var c = [], e = 0; e < b; e++) c.push(a[e]);
                return new d.operation(c)
            }
        };
        this.find = function(b) {
            this.classReg = /^(\.).*/;
            this.idReg = /^(\#).*/;
            this.nameReg = /^(name=).*/;
            this.nodes = [];
            this.element = null;
            if (void 0 == a.length) {
                if (b.match(this.classReg)) {
                    this.element = a.getElementsByTagName("*");
                    for (var c = 0; c < this.element.length; c++) b.replace(".", "") == this.element[c].className && this.nodes.push(this.element[c])
                } else {
                    if (b.match(this.idReg)) {
                        this.element = a.getElementsByTagName("*");
                        for (c = 0; c < this.element.length; c++) if (b.replace("#", "") == this.element[c].getAttribute("id")) return new d.operation(this.element[c]);
                        return
                    }
                    if (b.match(this.nameReg)) {
                        this.element = a.getElementsByTagName("*");
                        for (c = 0; c < this.element.length; c++) b.replace("name=", "") == this.element[c].getAttribute("name") && this.nodes.push(this.element[c])
                    } else return this.element = a.getElementsByTagName(b),
                    1 < this.element.length ? new d.operation(this.element) : new d.operation(this.element[0])
                }
                return 1 < this.nodes.length ? new d.operation(this.nodes) : new d.operation(this.nodes[0])
            }
        };
        this.parent = function(b) {
            if (! (void 0 != a.length || (!b || "number" != typeof b) && 1 > b)) {
                for (var c = a.parentNode,
                e = 1; e < b; e++) {
                    if ("#document" == c.nodeName) return;
                    c = c.parentNode
                }
                return new d.operation(c)
            }
        };
        this.previous = function() {
            for (a = a.previousSibling;;) {
                if (!a) return;
                if (1 == a.nodeType) break;
                a = a.previousSibling
            }
            return new d.operation(a)
        };
        this.next = function() {
            for (a = a.nextSibling;;) {
                if (!a) return;
                if (1 == a.nodeType) break;
                a = a.nextSibling
            }
            return new d.operation(a)
        };
        this.parentChild = function(b) {
            if (!a.parentNode || 0 >= a.parentNode.childNodes.length) return ! 1;
            this.classReg = /^(\.).*/;
            this.idReg = /^(\#).*/;
            this.nameReg = /^(name=).*/;
            this.nodes = [];
            this.element = null;
            for (var c in a.parentNode.childNodes) this.element = a.parentNode.childNodes[c],
            b.match(this.classReg) ? this.element.className == b.replace(".", "") && null != this.element && void 0 != this.element && this.nodes.push(this.element) : b.match(this.idReg) ? this.element.id == b.replace("#", "") && null != this.element && void 0 != this.element && this.nodes.push(this.element) : b.match(this.nameReg) ? this.element.name == b.replace("name=", "") && null != this.element && void 0 != this.element && this.nodes.push(this.element) : this.element.nodeName == b.toUpperCase() && null != this.element && void 0 != this.element && this.nodes.push(this.element);
            return 1 < this.nodes.length ? new d.operation(this.nodes) : new d.operation(this.nodes[0])
        };
        this.each = function(b) {
            if (void 0 == a) return ! 1;
            if (void 0 == a.length) return b.call(a, 0),
            !0;
            for (var c = 0; c < a.length; c++) b.call(a[c], c)
        };
        this.attr = function(b, c) {
            if (void 0 == a.length) {
                if (void 0 == c || null == c) return "value" == b ? a.value: a.getAttribute(b);
                "value" == b ? a.value = c: a.setAttribute(b, c);
                return ! 0
            }
        };
        this.width = function(b) {
            if (void 0 == a.length) {
                if (void 0 == b || null == b) return "" == a.offsetWidth ? 0 : a.offsetWidth;
                a.style.width = b + "px";
                return ! 0
            }
        };
        this.height = function(b) {
            if (void 0 == a.length) {
                if (void 0 == b || null == b) return "" == a.offsetHeight ? 0 : a.offsetHeight;
                a.style.height = b + "px";
                return ! 0
            }
        };
        this.dimension = function() {
            if (void 0 == a.length) {
                var b = this.css().display;
                if ("none" != b && null != b) return {
                    width: a.offsetWidth,
                    height: a.offsetHeight
                };
                var b = a.style,
                c = b.visibility,
                e = b.display;
                b.visibility = "hidden";
                b.display = "block";
                var d = a.clientWidth,
                f = a.clientHeight;
                b.display = e;
                b.visibility = c;
                return {
                    width: d,
                    height: f
                }
            }
        };
        this.offset = function() {
            if (void 0 == a.length) {
                for (var b = 0,
                c = 0,
                e = a; null != e;) b += e.offsetLeft,
                c += e.offsetTop,
                e = e.offsetParent;
                return {
                    x: b,
                    y: c
                }
            }
        };
        this.html = function(b) {
            if (void 0 == b || null == b) {
                if (void 0 == a.length) return a.innerHTML;
                if (1 == a.length) return a[0].innerHTML
            } else return void 0 == a.length ? (a.innerHTML = b, !0) : 1 == a.length ? (a[0].innerHTML = b, !0) : !1
        };
        this.append = function(b) {
            if (void 0 == b || void 0 != a.length) return ! 1;
            a.innerHTML += b;
            return ! 0
        };
        this.show = function(b) {
            if (void 0 != a.length) return ! 1;
            a.style.display = b || "block";
            return ! 0
        };
        this.hide = function() {
            if (void 0 != a.length) return ! 1;
            a.style.display = "none";
            return ! 0
        };
        this.toggle = function(b) {
            if (void 0 != a.length) return ! 1;
            a.style.display = "none" != (new d.operation(a)).css().display ? "none": b || "block";
            return ! 0
        };
        this.css = function(b) {
            if (void 0 != a.length) return ! 1;
            if (!b) return a.currentStyle || document.defaultView.getComputedStyle(a, null);
            var c = "",
            e;
            for (e in b) c += e + ":" + b[e] + ";";
            a.style.cssText = c;
            return ! 0
        };
        this.hasClass = function(b) {
            return void 0 != a.length || !a.className ? !1 : RegExp("\\b" + b + "\\b").test(a.className)
        };
        this.addClass = function(b) {
            if (void 0 != a.length) return ! 1;
            if (!a.className) return a.className = b,
            !0;
            if (this.hasClass(b)) return ! 1;
            a.className = a.className + " " + b
        };
        this.removeClass = function(b) {
            if (void 0 != a.length || !a.className) return ! 1;
            b = a.className.replace(RegExp("\\b" + b + "\\b"), "");
            a.className = b.trim();
            return ! 0
        };
        this.fadeIn = function(b) {
            if (! (void 0 != a.length || "none" != a.style.display)) {
                b || (b = 30);
                d.isIE() ? a.style.filter = "alpha(opacity=0)": a.style.opacity = 0;
                this.show();
                var c = 0,
                e = setInterval(function() {
                    d.isIE() ? (a.style.filter = "alpha(opacity=" + (c += 2) + ")", 100 <= c && clearInterval(e)) : (a.style.opacity = c += 0.02, 1 <= c && clearInterval(e))
                },
                b)
            }
        };
        this.fadeOut = function(b) {
            if (void 0 != a.length || "none" == a.style.display) return ! 1;
            b || (b = 30);
            var c = d.isIE() ? 100 : 1,
            e = setInterval(function() {
                d.isIE() ? a.style.filter = "alpha(opacity=" + (c -= 2) + ")": a.style.opacity = c -= 0.02;
                0 >= c && (clearInterval(e), a.style.display = "none")
            },
            b)
        };
        this.slideDown = function(b, c) {
            if (! (void 0 != a.length || "none" != a.style.display)) {
                b || (b = 1);
                c || (c = 30);
                var e = a.style;
                e.display = "block";
                e.overflow = "hidden";
                var d = this.height();
                e.height = "0px";
                var f = setInterval(function() {
                    var a = parseInt(e.height) + b;
                    a >= d ? clearInterval(f) : e.height = a + "px"
                },
                c)
            }
        };
        this.slideUp = function(b, c) {
            if (! (void 0 != a.length || "none" == a.style.display)) {
                b || (b = 1);
                c || (c = 30);
                var e = this.height(),
                d = a.style;
                d.overflow = "hidden";
                d.height = e + "px";
                var f = setInterval(function() {
                    var c = parseInt(d.height) - b;
                    0 >= c ? (clearInterval(f), a.style.display = "none", a.style.height = e + "px") : a.style.height = c + "px"
                },
                c)
            }
        };
        this.toggleSlide = function(b, c) {
            void 0 == a.length && ("none" == a.style.display ? this.slideDown(b, c) : this.slideUp(b, c))
        };
        this.click = function(b) {
            if (void 0 != a.length) return ! 1;
            this.addEvent("click", b);
            return ! 0
        };
        this.addEvent = function(b, c) {
            if (void 0 != a.length || !b || !c) return ! 1;
            d.isIE() ? (a["e" + b + c] = c, a[b + c] = function() {
                a["e" + b + c](window.event)
            },
            a.attachEvent("on" + b, a[b + c])) : a.addEventListener(b, c, !1);
            return ! 0
        };
        this.removeEvent = function(b, c) {
            if (void 0 != a.length || !b || !c) return ! 1;
            d.isIE() ? (a.detachEvent("on" + b, a[b + c]), a[b + c] = null) : a.removeEventListener(b, c, !1);
            return ! 0
        };
        this.removeFirst = function() {
            if (void 0 != a.length || 1 > a.childNodes.length) return ! 1;
            for (var b = a.childNodes,
            c = 0; c < b.length; c++) if ("#text" != b[c].nodeName) return a.removeChild(b[c]),
            !0;
            return ! 1
        };
        this.removeLast = function() {
            if (void 0 != a.length || 1 > a.childNodes.length) return ! 1;
            for (var b = a.childNodes.length - 1; 0 <= b; b--) if ("#text" != a.childNodes[b].nodeName) return a.removeChild(a.childNodes[b]),
            !0;
            return ! 1
        };
        this.removeChildAll = function() {
            if (void 0 != a.length) return ! 1;
            for (; a.firstChild;) a.removeChild(a.firstChild);
            return ! 0
        }
    };
    d.dom = {
        clone: function(a) {
            return void 0 == a ? void 0 : a.cloneNode(!0)
        },
        prepend: function(a, b) {
            a.firstChild ? a.insertBefore(b, a.firstChild) : a.appendChild(b);
            return ! 0
        },
        append: function(a, b) {
            a.appendChild(b);
            return ! 0
        },
        insertBefore: function(a, b, c) {
            a.childNodes[c] ? a.insertBefore(b, a.childNodes[c]) : a.appendChild(b);
            return ! 0
        },
        remove: function(a, b) {
            a.removeChild(b);
            return ! 0
        },
        create: function(a, b, c, e) {
            if ("string" != typeof a) return ! 1;
            a = document.createElement(a);
            if (b) for (var g in b) a.setAttribute(g + "", b[g] + "");
            c && "string" == typeof c && (d.isIE() ? document.documentMode ? a.setAttribute("class", c) : a.setAttribute("className", c) : a.setAttribute("class", c));
            e && (new d.operation(a)).css(e);
            return a
        }
    };
    d.append = d.dom.append;
    d.create = d.dom.create;
    d.remove = d.dom.remove;
    d.ajax = {
        async: !0,
        errorCallBack: void 0,
        prepare: function(a, b, c, e) {
            e && (this.errorCallBack = e);
            e = "";
            if (c && "object" == typeof c) for (var d in c) e += "&" + d + "=" + c[d];
            "get" == b ? (e += "&r=" + (new Date).getTime(), e = e.substr(1, e.length), a += ( - 1 == a.indexOf("?") ? "?": "&") + e) : 0 < e.length && (c = e.substr(1, e.length));
            return {
                url: a,
                method: b,
                param: c
            }
        },
        send: function(a, b, c) {
            var e = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest;
            e.open(a.method, a.url, this.async);
            e.setRequestHeader("X-Requested-With", "ajax");
            e.onreadystatechange = function() {
                if (! (4 > e.readyState)) if (200 == e.status) {
                    if (b) {
                        var a = e.responseText;
                        "json" == c && (a = eval("(" + e.responseText + ")"));
                        b.call(this, a)
                    }
                } else d.ajax.errorCallBack && d.ajax.errorCallBack.call(this, e.status)
            };
            "get" == a.method ? e.send() : (e.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"), e.send(a.param))
        },
        get: function(a, b, c, e, g) {
            d.ajax.send(d.ajax.prepare(a, "get", b, g), c, e)
        },
        post: function(a, b, c, e, g) {
            d.ajax.send(d.ajax.prepare(a, "post", b, g), c, e)
        }
    };
    d.get = d.ajax.get;
    d.post = d.ajax.post;
    d.cookie = {
        get: function(a) {
            a = document.cookie.match(RegExp("(^| )" + a + "=([^;]*)(;|$)"));
            return ! a ? "": decodeURIComponent(a[2])
        },
        set: function(a, b, c, e, d) {
            var f = new Date;
            f.setTime(f.getTime() + d);
            document.cookie = a + "=" + b + "; expires=" + f.toGMTString() + "; path=" + (c ? c: "/") + "; " + (e ? "domain=" + e + ";": "")
        },
        setSessionCookie: function(a, b, c, d) {
            document.cookie = a + "=" + b + "; path=" + (c ? c: "/") + "; " + (d ? "domain=" + d + ";": "")
        },
        remove: function(a, b, c) {
            document.cookie = a + "=; expires=Mon, 26 Jul 1997 05:00:00 GMT; path=" + (b ? b: "/") + "; " + (c ? "domain=" + c + ";": "")
        },
        clear: function() {
            var a = document.cookie.match(/([^ ;][^;]*)(?=(=[^;]*)(;|$))/gi),
            b;
            for (b in a) document.cookie = a[b] + "=;expires=Mon, 26 Jul 1997 05:00:00 GMT; path=/; "
        }
    };
    d.winName = {
        set: function(a, b) {
            var c = window.name || "";
            window.name = c.match(RegExp(";" + a + "=([^;]*)(;|$)")) ? c.replace(RegExp(";" + a + "=([^;]*)"), ";" + a + "=" + b) : c + ";" + a + "=" + b
        },
        get: function(a) {
            return (a = (window.name || "").match(RegExp(";" + a + "=([^;]*)(;|$)"))) ? a[1] : ""
        },
        remove: function(a) {
            window.name = (window.name || "").replace(RegExp(";" + a + "=([^;]*)"), "")
        }
    };
    d.scrollTop = function() {
        return document.documentElement.scrollTop || document.body.scrollTop
    };
    d.scrollWidth = function() {
        return document.documentElement.scrollWidth || document.body.scrollWidth
    };
    if (!window.$ || !window.Yan) window.$ = window.simple = d
})();
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "")
};